Skip to content

Drop step-specific "base Click command" implementations - #4457

Merged
LecrisUT merged 7 commits into
mainfrom
base-command-to-base-plugin-class
Mar 18, 2026
Merged

Drop step-specific "base Click command" implementations#4457
LecrisUT merged 7 commits into
mainfrom
base-command-to-base-plugin-class

Conversation

@happz

@happz happz commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

They are not that different, each step class just used different step name, and that was it. Dropping the base_command method from Step-like classes, replacing them with a shared implementation.

Also, --how now prints allowed/known plugins as possible choices. I was editing the help text, and this felt like a natural change of the option.

Pull Request Checklist

  • implement the feature

@happz happz added this to planning Jan 4, 2026
@happz happz added code | cli Changes related to the command line interface code | style Code style changes not affecting functionality code | no functional change "No Functional Change" intended. Patch should not change tmt's behavior in any way. ci | full test Pull request is ready for the full test execution labels Jan 4, 2026
@github-project-automation github-project-automation Bot moved this to backlog in planning Jan 4, 2026
@happz happz moved this from backlog to implement in planning Jan 4, 2026
@happz
happz force-pushed the base-command-to-base-plugin-class branch from 8af29bc to b5373c7 Compare January 4, 2026 20:15
@LecrisUT LecrisUT self-assigned this Jan 5, 2026

@LecrisUT LecrisUT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just 2 minor issues.

Comment thread tmt/steps/cleanup/__init__.py
Comment thread tmt/steps/__init__.py Outdated
@LecrisUT LecrisUT removed their assignment Jan 7, 2026
@happz
happz force-pushed the base-command-to-base-plugin-class branch from b5373c7 to d9fc940 Compare February 13, 2026 10:33
@happz happz moved this from implement to review in planning Feb 13, 2026
@happz
happz force-pushed the base-command-to-base-plugin-class branch from d9fc940 to d76bcd0 Compare February 25, 2026 21:55
Comment thread tmt/steps/execute/__init__.py Outdated
@happz
happz force-pushed the base-command-to-base-plugin-class branch 2 times, most recently from 1268e00 to 48e6368 Compare March 2, 2026 08:40
@happz
happz force-pushed the base-command-to-base-plugin-class branch from 48e6368 to 3e49a3b Compare March 13, 2026 09:02
@therazix therazix self-assigned this Mar 13, 2026
thrix

This comment was marked as outdated.

thrix

This comment was marked as outdated.

@thrix thrix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Drop step-specific "base Click command" implementations

Reviewed against commit 3e49a3b.

Summary

Clean refactoring that consolidates 7 near-identical base_command() implementations (one per step plugin class) into a single shared implementation in BasePlugin. Removes ~220 lines of boilerplate. The shared version uses a new _step_class ClassVar backlink to derive the step name, and enhances --how to show available plugins as choices in the metavar.

Issues

1. Execute step gains PHASE_OPTIONS — functional change (medium)

The shared base_command() always applies @tmt.steps.PHASE_OPTIONS. However, the original execute step was the only step (out of 7) that did NOT use PHASE_OPTIONS. This means execute now gains --insert, --update, --update-missing, --allowed-how, --name, and --order CLI options it didn't have before. This contradicts the code | no functional change label. See inline comment.

2. Unrelated FileSystemPath/Package re-exports in tmt/steps/provision/__init__.py (minor)

These imports from tmt.package_managers are added as re-exports but nothing in the codebase imports them from tmt.steps.provision. Unrelated to the base_command refactoring. See inline comment.

Observations (no action needed)

  • The --how help text is now generic (f'Use specified method for {step_name} phase.') instead of step-specific (e.g., 'Use specified method for environment preparation.'). Minor wording change.
  • The --how metavar now lists available plugins (e.g., beaker|connect|container|local|virtual) instead of the generic METHOD. Nice improvement.
  • Removal of # type: ignore[type-abstract] in plan.py is correct — base_command was the only remaining abstract method in these plugin base classes, making them non-abstract now.
  • The module-level XPlugin._step_class = X assignments are well-documented and all 7 steps are covered.

Verdict

The refactoring is clean and correct. The main concern is issue #1 — the execute step gaining new CLI options should be acknowledged (and the no functional change label reconsidered) or handled explicitly.

Generated-by: Claude Code

Comment thread tmt/steps/__init__.py Outdated
Comment thread tmt/steps/provision/__init__.py Outdated
@psss psss added this to the 1.70 milestone Mar 16, 2026
@thrix
thrix self-requested a review March 16, 2026 14:27
@psss psss self-assigned this Mar 17, 2026
@happz
happz force-pushed the base-command-to-base-plugin-class branch from 3e49a3b to 5ae4d19 Compare March 17, 2026 09:40

@psss psss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice deduplication! Just one wording nitpick.

Comment thread tmt/steps/__init__.py
@happz
happz force-pushed the base-command-to-base-plugin-class branch from dfac67b to 67d9dc6 Compare March 17, 2026 17:01
@LecrisUT LecrisUT moved this from review to merge in planning Mar 18, 2026
@LecrisUT LecrisUT moved this from merge to review in planning Mar 18, 2026
@happz
happz force-pushed the base-command-to-base-plugin-class branch from 67d9dc6 to 07c9e82 Compare March 18, 2026 09:08
@LecrisUT LecrisUT moved this from review to merge in planning Mar 18, 2026
happz added 7 commits March 18, 2026 12:41
They are not that different, each step class just used different step
name, and that was it. Dropping the `base_command` method from
`Step`-like classes, replacing them with a shared implementation.

Also, `--how` now prints allowed/known plugins as possible choices. I
was editing the help text, and this felt like a natural change of the
option.
@LecrisUT
LecrisUT force-pushed the base-command-to-base-plugin-class branch from 07c9e82 to fe7aa81 Compare March 18, 2026 11:41
@LecrisUT
LecrisUT enabled auto-merge (squash) March 18, 2026 11:41
@LecrisUT
LecrisUT disabled auto-merge March 18, 2026 13:27
@LecrisUT
LecrisUT enabled auto-merge (squash) March 18, 2026 13:32
@LecrisUT
LecrisUT merged commit a6c2c6e into main Mar 18, 2026
32 checks passed
@LecrisUT
LecrisUT deleted the base-command-to-base-plugin-class branch March 18, 2026 13:34
@github-project-automation github-project-automation Bot moved this from merge to done in planning Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci | full test Pull request is ready for the full test execution code | cli Changes related to the command line interface code | no functional change "No Functional Change" intended. Patch should not change tmt's behavior in any way. code | style Code style changes not affecting functionality

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

5 participants